<?php
/**
 * Created by PhpStorm.
 * File name: DistributionJcLog.php
 * User: Ym
 * Date: 2023/2/18
 * Time: 22:55
 */

namespace app\jxcshop\controller\sys_admin;

use app\AdminController;
use think\Db;
class JiaquanfenhongJc extends AdminController
{
//*------------------------------------------------------ */
    //-- 初始化
    /*------------------------------------------------------ */
    public function initialize()
    {
        parent::initialize();
        $this->Model = new \app\jxcshop\model\JiaquanfenhongJc();
    }

    //*------------------------------------------------------ */
    //-- 首页
    /*------------------------------------------------------ */
    public function index()
    {

        $this->getList(true);

        $tatolamount = Db::table("jiaquanfenhong_jc")->where("isstatus",0)->sum("enter_amount");

        $this->assign("tatolamount",$tatolamount);
        return $this->fetch('index');
    }
    /*------------------------------------------------------ */
    //-- 获取列表
    //-- $runData boolean 是否返回模板
    /*------------------------------------------------------ */
    public function getList($runData = false, $is_cancel = false)
    {

        $jc_id = input('jc_id');
        /*
        $viewObj = $this->Model->alias('jc_log')
            ->join('shop_goods g', 'g.goods_id=jc_log.goods_id')
            ->join('shop_order_info o', 'o.order_id=jc_log.order_id')
            ->field('jc_log.*,g.goods_name,o.order_sn')
            ->where("jc_log.jc_id", '=', $jc_id)
            ->where("jc_log.stage", '=', date('Ym'));
        */
        $viewObj = $this->Model->where("1=1")->order("id DESC");

        $data = $this->getPageList($this->Model, $viewObj);
        $this->assign("data", $data);
        //$this->assign("search", $search);
        if ($runData == false) {
            $data['content'] = $this->fetch('list')->getContent();
            unset($data['list']);
            return $this->success('', '', $data);
        }
        return true;
    }

}